package cn.doitedu.day07

import org.apache.spark.sql.{DataFrame, SparkSession}

object T08_CreateDataFrameFromCsv {

  def main(args: Array[String]): Unit = {

    val spark = SparkSession.builder().appName(this.getClass.getSimpleName)
      .master("local[4]")
      .getOrCreate()

    //sparksql支持统一的数据访问方式
    val df: DataFrame = spark.read
      .option("header", "true") //将第一行作为表头
      .csv("data/login2.txt")

    df.printSchema()

    df.show()

  }

}
